package com.central.common.feign;

import com.central.common.constant.ServiceNameConstants;
import com.central.common.model.ProUserRole;
import com.central.common.model.SysProject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author Tindy
 * @date 2021/6/29
 * @describe
 */
@FeignClient(name = ServiceNameConstants.PROJECT_SERVICE, decode404 = true)
public interface ProjectService {
    /**
     * 用户项目列表
     */
    @GetMapping("/project/findUserProjects")
    List<SysProject> findProjects(@RequestParam("userId") Long userId);

    /**
     * 通过id获取项目信息
     */
    @GetMapping("/project/findById")
    SysProject findById(@RequestParam("proId") Long proId);

    /**
     * 获取单用户项目角色
     *
     * @param proId
     * @param userId
     * @return
     */
    @GetMapping("/project/findRolesByUserId")
    List<ProUserRole> findRolesByUserId(@RequestParam("proId") Long proId, @RequestParam("userId") Long userId);

    /**
     * 部门是否被项目引用
     *
     * @param departmentId
     * @return
     */
    @GetMapping("/project/countByDepartmentId")
    Integer countByDepartmentId(@RequestParam("departmentId") Long departmentId);


    /**
     * 查询项目成员及角色
     *
     * @param proId
     * @return
     */
    @GetMapping("/project/findRolesByProId")
    List<ProUserRole> findRolesByProId(@RequestParam("proId") Long proId);

    /**
     * 根据项目ids获取项目
     *
     * @param proIds
     * @return
     */
    @PostMapping("/project/findProByProIds")
    List<SysProject> findProByProIds(List<Long> proIds);


}